import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int m = sc.nextInt();
        long[] arr = new long[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextLong();
        }

        Arrays.sort(arr);

        long[] dp = new long[n + 1];
        for (int i = 1; i < n + 1; i++) {
            dp[i] = dp[i - 1] + arr[i - 1];
        }

        int left = 0, right = n - 1;
        while (left < right) {
            int mid = left + (right - left) / 2;
            long high = arr[mid];
            long sum = dp[n] - dp[mid + 1] - (n - mid - 1) * high;
            if (sum == m) {
                System.out.println(high);
                return;
            } else if (sum < m) {
                right = mid;
            } else {
                left = mid + 1;
            }
        }


        long high = arr[left];
        long sum = dp[n] - dp[left + 1] - (n - left - 1) * high;

        if (sum < m) {
            high -= (m - sum) % (n - left) == 0 ? (m - sum) / (n - left) : ((m - sum) / (n - left) + 1);
        } else {
            high += (sum - m) % (n - left) == 0 ? (sum - m) / (n - left) : ((sum - m) / (n - left) - 1);
        }

        System.out.println(high);

        sc.close();
    }
}
